﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace OpenWaves.ActivityFeed.Web.Tests.Samples
{
    public partial class SampleTopicsFilter : System.Web.UI.Page
    {
        public IEnumerable<Tuple<string, Topic>> AvailableTopics
        {
            get { return FakeUserProfileProvider.Users.Select(u => Tuple.Create(u.Value.Name, Topic.FromUserId(u.Key))); }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if ( !IsPostBack)
            {
                foreach (var topic in AvailableTopics)
                {
                    this.afMain.TopicsFilter.Add(topic.Item2);
                }
                this.DataBind();
            }
        }
    }
}